package test;

public class test {
    public static void main(String[] args) {
        BinarySortTree tree = new BinarySortTree();
        int[] arr = {7, 3, 10, 1, 5, 2, 9, 12, 11};
        for (int i = 0; i < arr.length; i++) {
            //增加
            tree.add(new Node(arr[i]));
        }
        //查询
        Node node = tree.searchNode(1);
        System.out.println(node);
        //删除
        //删除值为10的这个节点是带有左右孩子的特殊情况
        tree.delNode(7);
        System.out.println("+++++++++++前序遍历+++++++++++");
        tree.preOrder();
        System.out.println("+++++++++++中序遍历+++++++++++");
        tree.midOrder();
        System.out.println("+++++++++++后序遍历+++++++++++");
        tree.laterOrder();
    }
}
